{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.1 KMeans算法 & 13.2 DBSCAN算法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.1 KMeans算法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.1.2 KMeans算法的简单代码实现"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.构造数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "data = np.array([[3, 2], [4, 1], [3, 6], [4, 7], [3, 9], [6, 8], [6, 6], [7, 7]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[3, 2],\n",
       "       [4, 1],\n",
       "       [3, 6],\n",
       "       [4, 7],\n",
       "       [3, 9],\n",
       "       [6, 8],\n",
       "       [6, 6],\n",
       "       [7, 7]])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.可视化展示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "plt.scatter(data[:, 0], data[:, 1], c=\"red\", marker='o', label='samples')  # 以红色圆圈样式绘制散点图并加上标签\n",
    "plt.legend()  # 设置图例，图例内容为上面设置的label参数\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# plt.scatter?  # 如果想查看scatter的官方说明，可以在其plt.scatter后面加上?进行查看"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.KMeans聚类（聚类成2类）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KMeans(algorithm='auto', copy_x=True, init='k-means++', max_iter=300,\n",
       "    n_clusters=2, n_init=10, n_jobs=None, precompute_distances='auto',\n",
       "    random_state=None, tol=0.0001, verbose=0)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "kms = KMeans(n_clusters=2)\n",
    "kms.fit(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# KMeans?  # 如果想查看KMeans的官方说明，可以在其KMeans后面加上?进行查看"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.获取结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 1 0 0 0 0 0 0]\n"
     ]
    }
   ],
   "source": [
    "label = kms.labels_\n",
    "print(label)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.结果可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1b24b7c2668>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAFlNJREFUeJzt3XGQVeWZ5/Hv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
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(data[label == 0][:, 0], data[label == 0][:, 1], c=\"red\", marker='o', label='class0')  # 以红色圆圈样式绘制散点图并加上标签\n",
    "plt.scatter(data[label == 1][:, 0], data[label == 1][:, 1], c=\"green\", marker='*', label='class1')  # 以绿色星星样式绘制散点图并加上标签\n",
    "plt.legend()  # 设置图例"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "6.聚类成3类，并可视化呈现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 1 0 0 0 2 2 2]\n"
     ]
    }
   ],
   "source": [
    "kms_3 = KMeans(n_clusters=3)\n",
    "kms_3.fit(data)\n",
    "label_3 = kms_3.labels_\n",
    "print(label_3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1b24c84c518>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAF6lJREFUeJzt3X9w1fW95/HnGzguJvHHAjEiMYmIY1PARAxQlimSpl5ab4dOweliaJHa3dzdca/a7nhn79LVEgqDM+2M3rVzO6h7+4NcFfRKsShtd1i9286IBAUloJNKwYTeizFeAyyXNuJ7/zgnGI4n5HvI+Z5zPuT1mMmck+/3k+/3zUd4+cnnfL+fr7k7IiISjjGFLkBER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fHjH/+YF198EUiOrnfu3Mm2bduor69nz549NDc3M3fuXLZt28aiRYt47LHHqKyspKur68zxuru7ueqqq0ZUcyZaq0REik9Mn3k1NTWxadMment7AXj//ffP2n/8+HEmT55Mf38/bYOmZd5++23mzp1La2srkyZNoquri4MHDzJ16lTuvvtuFi9ezOuvv87s2bPp7Ozk97//PX/605948sknWbx48YhqzkS3vItI8Vm7NjmnPXi6JAefeU2fPp1Vq1Zx8803M3bsWG688UYGP/RlzZo1zJ07l+rqambOnMnx48cBuO++++js7MTdaWpqoq6ujvXr17Nx40YSiQRXXnkl999/P+PGjeORRx5h0aJFnD59mjvvvJPp06ePqOZMLNOczEg1NDS4HqQgIoMdOHCA2tra6D/Q1pac037nneRIe+3aC2YqNVNfmNlud2+I8vMacYtIcdJnXkPSHLeISGAU3CIigVFwi4gERsEtIhIYBbeISGAU3CIyquV6Wdc777yTK664ghkzZuTsmOkU3CIiObRy5Uq2b98e6zkU3CJStPpO9TH9h9PpO9WXs2PGuawrwIIFCz6xeFWuKbhFpGht69zG/vf283zn8zk5XtzLuuaLgltEik7zM82UrSvjji13ALBiywrK1pXR/EzziI4b97Ku+aLgFpGi09rYStVlVSTGJABIjElQfXk1axrXjOi4UZZ1feSRR3jjjTd44IEHOHXqFJAcXX/ve9+jq6uL+vp6ent7aW5uZuvWrVx88cUsWrSIHTt2jKi2bER9As63zKzDzPaZ2RNmNj7uwkRk9Jo2YRqtja30f9RPaaKU/o/6Wb1wNddOuHZEx417Wdd8GTa4zWwKcDfQ4O4zgLHAsrgLE5HCWrgw+VUomzo2UZooZfXC1ZQmStncsXnExxy8rGtdXR3f/va3z9o/sKzrLbfcwqc+9akz2++77z5mzpzJjBkzWLBgAXV1dTz11FPMmDGD+vp63nzzTVasWAHA7bffzrx583jrrbeorKw8M0+eS8Mu65oK7peBOuAYsAX4G3f/1VA/o2VdRcI3ENqph8CMWLbLuu46souqy6qoKKvg6ImjdB3rouGqSKueFr3Yl3V19yNm9n3gHeBfgV+dK7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r6V5IcSPzOz35EcOS4rkrruNrPFwIepulbmoa6MiqC/otRViP6qAJ5N/ZseB/y9u283s/8E4O4/Ap4HbgV+B5wEvlEkdd0G/Gcz+xD4V2BZ3P8DBv4SaEv9+n8Q+EYR9FWUugrRV5hZCXAL8BeDtuW1v3TnpIhIYAo+xy0iItlRcIuIBEbBLSISGAW3iEhgFNwiIoFRcIuIBEbBLSISGAW3iEhg/j93a8xuZTm2VQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(data[label_3 == 0][:, 0], data[label_3 == 0][:, 1], c=\"red\", marker='o', label='class0')  # 以红色圆圈样式绘制散点图并加上标签\n",
    "plt.scatter(data[label_3 == 1][:, 0], data[label_3 == 1][:, 1], c=\"green\", marker='*', label='class1')  # 以绿色星星样式绘制散点图并加上标签\n",
    "plt.scatter(data[label_3 == 2][:, 0], data[label_3 == 2][:, 1], c=\"blue\", marker='+', label='class2')  # 以蓝色加号样式绘制散点图并加上标签\n",
    "plt.legend()  # 设置图例"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.1.3 案例实战 - 银行客户分群模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>年龄(岁)</th>\n",
       "      <th>收入(万元)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>50</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>44</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>30</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>46</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>32</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   年龄(岁)  收入(万元)\n",
       "0     50      66\n",
       "1     44      51\n",
       "2     30      56\n",
       "3     46      50\n",
       "4     32      50"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd \n",
    "data = pd.read_excel('客户信息.xlsx')\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.可视化展示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X2UXVWZ5/HvQ1VeMNGESFkdwVAB0kqIilJhNPQ4vEijQgcaAosEJGuGWcys1fFlyQpiz6KHJMjIMK30ArQbAY0zVMgbL1m+YkcZe2QBCYgCoUOwLcJrCJAEaCEhlWf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ure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "plt.scatter(data.iloc[:, 0], data.iloc[:, 1], c=\"green\", marker='*')  # 以绿色星星样式绘制散点图\n",
    "plt.xlabel('age')  # 添加x轴名称\n",
    "plt.ylabel('salary')  # 添加y轴名称\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.数据建模"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "kms = KMeans(n_clusters=3, random_state=123)\n",
    "kms.fit(data)\n",
    "label = kms.labels_\n",
    "label = kms.fit_predict(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 1 2 1 2 2 1 2 2 1 1 1 1 2 1 1 1 2 1 1 1 2 2 1 1 1 1 2 2 1 2 1 2 2 2 0 2\n",
      " 1 2 0 1 1 2 1 2 1 2 1 1 2 2 0 1 2 1 1 1 1 2 1 2 2 2 2 0 0 0 0 0 0 0 0 0 0\n",
      " 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 1 1 1 2 1 2 0 0 0 0 0 0\n",
      " 2]\n"
     ]
    }
   ],
   "source": [
    "print(label)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.建模效果可视化展示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1b24d5fa978>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEKCAYAAAAfGVI8AAAABHN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jmnRCAiknNKBCIiOadEICKSc0oEIiI5p0Qg0gYz+1UwsdjypsnFzOwqM/ubmS0yswfN7L5gfV8zW2Bmi4Pl7GSjF2mbBpSJtMHMerv7xmBaisXAecCLwCnAVmAhsNTdZ5jZI8D/cvf/Z2b9gWeCe1CIpFZWppgQSdLVZvbl4OfjKEwV8oK7bwQwsyeATwW//yxwUjD1AMDhZnZYcA8KkVRSIhBphZmNo/Dlfqa7bzezRcAqWp6CGwrl1jPd/cPSRCjScWojEGndEcCmIAmcSGHq7R7AWDM7Mpj6eXKz7X8PzGh6koV774ooEYi07mmgi5m9CtwM/Al4C7iVwh3m/g+wAtgSbH81MDq409YK0j+Lpogai0Xaw8x6uvu24IrgSeAn7v5k0nGJtIeuCETa58bgvhLLgDeBXyUcj0i76YpARCTndEUgIpJzSgQiIjmnRCAiknNKBCIiOadEICKSc0oEIiI59/8Bjr7cUMAXI8YAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(data[label == 0].iloc[:, 0], data[label == 0].iloc[:, 1], c=\"red\", marker='o', label='class0')  # 以红色圆圈样式绘制散点图并加上标签  \n",
    "plt.scatter(data[label == 1].iloc[:, 0], data[label == 1].iloc[:, 1], c=\"green\", marker='*', label='class1')  # 以绿色星星样式绘制散点图并加上标签 \n",
    "plt.scatter(data[label == 2].iloc[:, 0], data[label == 2].iloc[:, 1], c=\"blue\", marker='+', label='class2')  # 以蓝色加号样式绘制散点图并加上标签\n",
    "plt.xlabel('age')  # 添加x轴名称\n",
    "plt.ylabel('salary')  # 添加y轴名称\n",
    "plt.legend()  # 设置图例"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.补充知识点，查看各标签人的收入均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "21.125\n",
      "57.55555555555556\n",
      "46.285714285714285\n"
     ]
    }
   ],
   "source": [
    "print(data[label == 0].iloc[:, 1].mean())  # 看下分类为标签0的人的收入均值，iloc[:, 1]为data表格的第二列，也即“收入”列\n",
    "print(data[label == 1].iloc[:, 1].mean())\n",
    "print(data[label == 2].iloc[:, 1].mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.2 DBSCAN算法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.2.2 DBSCAN算法的代码实现"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>x</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10.44</td>\n",
       "      <td>5.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>11.55</td>\n",
       "      <td>6.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>11.36</td>\n",
       "      <td>5.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10.62</td>\n",
       "      <td>6.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>11.20</td>\n",
       "      <td>5.39</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       x     y\n",
       "0  10.44  5.74\n",
       "1  11.55  6.16\n",
       "2  11.36  5.10\n",
       "3  10.62  6.12\n",
       "4  11.20  5.39"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "data = pd.read_excel('演示数据.xlsx')\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.数据可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAH5tJREFUeJzt3XtwXOWZ5/Hvo7stgS/YoxBjY2MnUJAQJ5EY1t6icEgwJpRhwbhs2QsJ2VDMxpP5gxWXmgEGeQkZksrOrJnhMmSXzC4y+MJFCczEhCRFzSQkloEANtFigweDMRgMAmLL1uXZP9TqtFrdUt9O9zndv0+VSq3u092vTp9+n/e8l+eYuyMiIgJQVeoCiIhIeCgoiIhInIKCiIjEKSiIiEicgoKIiMQpKIiISJyCgoiIxCkoiIhInIKCiIjE1ZS6ANmaMWOGz507t9TFEBGJlB07drzr7jMn2i5yQWHu3Ll0d3eXuhgiIpFiZv+eyXbqPhIRkTgFBRERiVNQEBGROAUFERGJU1AQEZE4BQUREYlTUBARkTgFBYms3r5ezvj7M+jt6y11UcYVlXKKgIKCRNjjrzzOrnd38cQrT5S6KOOKSjkLRUEw2hQUJHLatrbR9J0mrnz0SgCuePQKmr7TRNvWthKXb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WgnDazvwKTObZ2Z1DK+uL6uZWbkws0YzO27kNsPfoZfGf1Z0mdkFwPXAcnc/nGaz8j5W3D30P8BG4C2gn+Eo/Q2GU2w/BbwS+z09tm0LcF/Cc68Cdsd+vl7q/6XU+wRYBLwI/C72+xul/l+KsF/+U+z2UeBt4KexbT8JPJHw3AsZnnGyB/jLUv8vYdgvwCmxY+V3wM5y2i9p9sluhscLno/93F1px4pWNIuISFyUu49ERKTAFBRERCROQUFEROIUFEREJE5BQURE4hQUREQkTkFBRETiFBRE8mRmrbH8+w2xFcA7zewzpS6XSC60eE2kAMzsvwMNwCTgDXe/vcRFEsmJgoJIAcRy4GwH+oBF7j5Y4iKJ5ETdRyKFMR1oAo5j+IxBJJJ0piBSALFrXT8IzANOdPd1JS6SSE7K/SI7IoEzsyuAAXfvjF2/91dm9iV3/3mpyyaSLZ0piIhInMYUREQkTkFBRETiFBRERCROQUFEROIUFEREJE5BQURE4hQUREQkTkFBRETi/j+8bEjP8vJAQwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "plt.scatter(data.iloc[:, 0], data.iloc[:, 1], c=\"green\", marker='*')  # 以绿色星星样式绘制散点图\n",
    "plt.xlabel('x')  # 添加x轴名称\n",
    "plt.ylabel('y')  # 添加y轴名称\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.数据建模"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.cluster import DBSCAN\n",
    "dbs = DBSCAN()\n",
    "dbs.fit(data)\n",
    "label_dbs = dbs.labels_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "# DBSCAN?  # 如果想查看DBSCAN的官方说明，可以在其DBSCAN后面加上?进行查看"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.查看聚类结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 0 1 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 1 0\n",
      " 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0 1\n",
      " 1 1 1 1 1 0 1 0 0 1 0 0 1 0 1 1 1 1 0 1 1 1 0 1 1 0]\n"
     ]
    }
   ],
   "source": [
    "print(label_dbs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.用散点图展示DBSCAN算法的聚类结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1b24d699208>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xt0VPXZL/DvM7mSBEEuUjUkAVFBUFCCVDhS0FrUurBVZAlpkeopx/f1tlYrb+3iWCUY8bZqVfqWovZoDwEJXnmrora0rz1vW0io3IJyAOUSEMWgQQ8GQvKcP/bMMJnMTuayfzN77/l+1po1ycyePb/szPye/bs9W1QVREREABDIdAGIiMg9GBSIiCiMQYGIiMIYFIiIKIxBgYiIwhgUiIgojEGBiIjCGBSIiCiMQYGIiMJ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yDgRmQ3ghKouD16/928icpmqrs102YgSxZYCERGFcUyBiIjCGBSIiCiMQYGIiMIYFIiIKIxBgYiIwhgUiIgojEGBiIjCGBSIiCjs/wPa+bpTPFDpuQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(data[label_dbs == 0].iloc[:, 0], data[label_dbs == 0].iloc[:, 1], c=\"red\", marker='o', label='class0')  # 以红色圆圈样式绘制散点图并加上标签  \n",
    "plt.scatter(data[label_dbs == 1].iloc[:, 0], data[label_dbs == 1].iloc[:, 1], c=\"green\", marker='*', label='class1')  # 以绿色星星样式绘制散点图并加上标签 \n",
    "plt.xlabel('x')  # 添加x轴名称\n",
    "plt.ylabel('y')  # 添加y轴名称\n",
    "plt.legend()  # 设置图例"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 13.2.3 KMeans VS DBSCAN"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "KMs = KMeans(n_clusters=2)\n",
    "KMs.fit(data)\n",
    "label_kms = KMs.labels_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "# KMs # 这样可以查看模型参数，这里没有设置random_state参数，所以可能每次跑出来的结果略有不同（因为每次起始点选的地方不同）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 1\n",
      " 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0\n",
      " 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0]\n"
     ]
    }
   ],
   "source": [
    "print(label_kms)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x1b24d6dfeb8>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X10VHWaJ/Dvk6RCIOWgBCyVmATEYyuvDomusNIwHhvt7hN30e6DCQ1I73CcaUbPaTb9MulVCR3afjln2hFHD+quuAm+stKZ8a3dZuf0mTPTLcEGFTQbtIOJKGpoIiwCIXn2j1tVU6nUy62q+17fzzl1qlJ16+aXWze/p+7v5fmJqoKIiAgAStwuABEReQeDAhERxTEoEBFRHIMCERHFMSgQEVEcgwIREcUxKBARURyDAhERxTEoEBFRXJnbBcjV1KlTta6uzu1iEBH5yt69ez9T1WnZtvNdUKirq0N3d7fbxSAi8hUROWxmOzYfERFRHIMCERHFMSgQEVGc7/oUiIhSGR4exsDAAE6fPu12UVxVUVGB6upqhEKhvN7PoEBEgTAwMIDzzjsPdXV1EBG3i+MKVcXg4CAGBgYwY8aMvPbB5iMiCoTTp0+jqqqqaAMCAIgIqqqqCrpaYlAgosAo5oAQU+gxYFAgIqI4BgUimw2dHsLsh2Zj6PSQ20Uhh9133334xS9+Ydn+XnnlFVxxxRWYNWsW7r//fsv2m4hBgXzNDxXui70v4uBnB/FS70tuF4V8bGRkBN/5znfw8ssv4+DBg3jqqadw8OBBy38PgwL5mpcr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8HUBzmgwLgT5X/B4UEtNkrAHwqxTbvArgKyJyQbSD+SvR54Iq6zGJHosJ0cdTASwGcNCxEnrTHgCXi8gMESmHMbs+MKOy8iUilSJyXuwxjP+ftzO/y79E5CYA3wfQqKqn0mwW7HNFVX1xA/AUgI8ADMOI1N+GkWb7NwB6o/dTotvWA3gs4b3rAByK3u5w+29x+5gAWATgLQD7o/ffdvtvsfmY/Ofo4zMAjgJ4NbrtJQBeSnjvV2GMOHkPQKvbf4sXjguAmdHzZD+AA0E6LmmOySEY/QX7ordHiu1c4YxmIiKK83vzERERWYhBgYiI4hgUiIgojkGBiIjiGBSIiCiOQYGIiOIYFIiIKI5BgahAItIQzb9fEZ0BfEBE5rhdLqJ8cPIakQVE5McAKgBMBDCgqj9xuUhEeWFQILJANAfOHgCnASxS1RGXi0SUFzYfEVljCoAwgPNgXDEQ+RKvFIgsEF3n+mkAMwBcrKobXC4SUV6KYZEdIluJyGoA51R1R3T93n8Vkb9Q1d1ul40oV7xSICKiOPYpEBFRHIMCERHFMSgQEVEcgwIREcUxKBARURyDAhERxTEoEBFRHIMCERHF/X/3X3fzIkUr8QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(data[label_kms == 0].iloc[:, 0], data[label_kms == 0].iloc[:, 1], c=\"red\", marker='o', label='class0')  # 以红色圆圈样式绘制散点图并加上标签  \n",
    "plt.scatter(data[label_kms == 1].iloc[:, 0], data[label_kms == 1].iloc[:, 1], c=\"green\", marker='*', label='class1')  # 以绿色星星样式绘制散点图并加上标签 \n",
    "plt.xlabel('x')  # 添加x轴名称\n",
    "plt.ylabel('y')  # 添加y轴名称\n",
    "plt.legend()  # 设置图例"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看到，对于形状类似同心圆的数据，KMeans算法聚类效果较差，只能机械地将数据分为左右两部分，而无法以外圆内圆的方式进行区分。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
